package com.letoken.platform.repo.ecommerce.dao;

import com.letoken.platform.repo.ecommerce.po.EcommerceUserAddress;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 用户地址 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2023-09-08
 */
public interface EcommerceUserAddressMapper extends BaseMapper<EcommerceUserAddress> {

    @Select("select * from ecommerce_user_address where id = #{id} and user_id = #{userId} and type=#{type} ")
    EcommerceUserAddress selectByUserIdAndIdAndType(@Param("id")Integer id , @Param("userId") Integer userId,@Param("type") Integer type);



    @Select("select * from ecommerce_user_address where  user_id = #{userId} and type=1 and default_status = 1 limit 1 ")
    EcommerceUserAddress selectShopDefaultAddress (@Param("userId") Integer userId);
}
